package com.paotui.controller;

import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.paotui.common.R;
import com.paotui.pojo.Users;
import com.paotui.service.impl.UsersServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/users/remove")
public class UsersRemoveController extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int UsersID = Integer.parseInt(request.getParameter("UsersID"));
        UsersServiceImpl impl = new UsersServiceImpl();
        impl.removeById(UsersID);
        R r = R.success("删除成功");
        response.getWriter().write(JSONUtil.toJsonStr(r));

//
//        QueryWrapper<Users> queryWrapper=new QueryWrapper<>();
//        queryWrapper.eq("usersId",UsersID);
//        Users users = impl.getOne(queryWrapper);
//        response.getWriter().write(JSONUtil.toJsonStr(R.success("查询成功",users)));


    }
}
